//****************************************************************************
//
// IR sensor - to - LED example
//
//****************************************************************************

#configure board        hu_arm_v4
#configure clcd_lines   2
#configure memory       rom
#configure baudrate     38400

#include "pRTOS.h"
#include "armboard.h"

int main( void ){
   RTOS::run();
   return 0;
}

// end of standard part

void led_set( int n, int v ){
   static int leds = 0;   
   if( v ){ leds |= 1 << n; } else { leds &=~ 1 << n; }
   armboard::LEDs::write( leds );
}


class sensor : public RTOS::task {
private:
   void main( void ){
      armboard::input_pin & sensor = armboard::chip::pin_1_24;
      sensor.direction_set_input();
      for(;;){
         led_set( 1, 0 );
         sleep( 1 MS );
         if( ! sensor.get() ){
            led_set( 1, 1 );
		 }
      }
   }
};

sensor s;



